<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style type="text/css">
        .colorInput {
            display: none;
            position: fixed;
            bottom: 0px;
            right: 0px;
        }
    </style>

</head>

<body>
    <script>
        let colorInput = null
        const colorChooseInit = () => {
            colorInput = document.createElement('input')
            colorInput.type = 'color'
            colorInput.className = 'colorInput'
            colorInput.addEventListener('input', async () => {
                try {
                    await navigator.clipboard.writeText(colorInput.value);
                    console.log('文本已复制到剪贴板');
                } catch (err) {
                    console.error('无法复制文本:', err);
                }
            })
            document.body.appendChild(colorInput)
        }
        document.addEventListener('keydown', (event) => {
            if (event.ctrlKey && event.key === 'q') {
                colorInput.click()
                event.preventDefault()
            }
        })
        colorChooseInit()
    </script>
</body>

</html>